home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 06 - 1990 / 06.07 Jul 90 / Printing Primer ƒ / SetStyle.c < prev   
Encoding:
C/C++ Source or Header  |  1989-11-07  |  1.9 KB  |  82 lines  |  [TEXT/KAHL]

  1. /*******************************************\
  2. *    file:         PrintTitle.c                *
  3. *    version:    0.1ß                        *
  4. *     XFCN ID        505                            *
  5. *                                            *
  6. * Sets style information about the text        *
  7. * Providing no parameters will reset the     *
  8. * style.                                    *
  9. *                                            *
  10. * -----------------------------------------    *
  11. * By:    Donald Koscheka                        *
  12. * Date:    30-OCT-89                            *
  13. * ©    Copyright 1989, Donald Koscheka            *
  14. *    All Rights Reserved                        *
  15. *                                            *
  16. * -----------------------------------------    *
  17. \*******************************************/
  18.  
  19. #include <MacTypes.h>
  20. #include <MemoryMgr.h>
  21. #include <ResourceMgr.h>
  22. #include <OSUtil.h>
  23. #include <HyperXCmd.h>
  24. #include <HyperUtils.h>
  25. #include <PrintMgr.h>
  26. #include "ReportUtils.h"
  27.  
  28.  
  29. pascal void main( paramPtr )
  30.     XCmdBlockPtr    paramPtr;
  31. /**********************************
  32. * params[0] == the font        
  33. * params[1] == the size    
  34. * params[2] == the style
  35. * params[3] == the justification
  36. *
  37. * SHOULD BE ABLE TO RESET THE DEFAULT
  38. * UNDER PROGRAM CONTROL!!! (REQUIRES
  39. * ADDING FIELDS TO pInfo).
  40. **********************************/
  41. {
  42.     Handle        pH;
  43.     pInfoPtr    pp;
  44.     short        theFont    = DEFAULT_FONT;
  45.     short        theSize    = DEFAULT_SIZE;
  46.     short        theStyle= PLAIN_TEXT;
  47.     short        theJust    = teJustLeft;
  48.     long        siz;
  49.     char        *fp1;
  50.     char        *fp2;
  51.     char        fontName[256];
  52.     stylePtr    sp;
  53.         
  54.     if( pH = GetSystemResource( PAGE_INFO, PAGE_ID )  ){
  55.         pp = (pInfoPtr)*pH;
  56.                 
  57.         if( paramPtr->params[0] ){
  58.             paramtoPString( paramPtr, 0, (char *)fontName );
  59.             GetFNum( fontName, &theFont );
  60.         }
  61.         
  62.         if( paramPtr->params[1] )
  63.             theSize = parseNum( *(paramPtr->params[1] ) );
  64.         
  65.         if( paramPtr->params[2] )
  66.             theStyle = (short)matchToken( paramPtr->params[2], TEXT_STYLES );
  67.         
  68.         if( paramPtr->params[3] )        
  69.             theJust = (short)matchToken( paramPtr->params[3], TEXT_JUSTIFICATION );
  70.         
  71.         sp = (stylePtr)&(pp->curntStyle);
  72.         SetFont( sp, theFont );
  73.         SetFontSize( sp, theSize );
  74.         SetFontStyle( sp, theStyle );
  75.         SetFontJust( sp, theJust );
  76.     }
  77.     
  78.     paramPtr->returnValue = NIL;
  79. }
  80.  
  81.  
  82.